#define _CRT_SECURE_NO_WARNINGS 1
#include "sort.h"
//void TestShellSort()
//{
//	int a[] = { 9,8,7,6,5,4,3,3,2,1,0 };
//	PrintArray(a, sizeof(a) / sizeof(int));
//	ShellSort(a, sizeof(a) / sizeof(int));
//	PrintArray(a, sizeof(a) / sizeof(int));
//}

void TestOP()
{
	srand(time(0));
	const int N = 1000000;
	int* a1 = (int*)malloc(sizeof(int) * N);
	int* a2 = (int*)malloc(sizeof(int) * N);
	int* a3 = (int*)malloc(sizeof(int) * N);
	for (int i = 0; i < N; ++i)
	{
		a1[i] = rand();
		a2[i] = a1[i];
		a3[i] = a1[i];
	}
	int begin1 = clock();
	InsertSort(a1, N);
	int end1 = clock();
	int begin2 = clock();
	ShellSort(a2, N);
	int end2 = clock();
	int begin3 = clock();
	QuickSort(a3, 0, N - 1);
	int end3 = clock();
	printf("InsertSort:%d\n", end1 - begin1);
	printf("ShellSort:%d\n", end2 - begin2);
	printf("QuickSort:%d\n", end3 - begin3);
	free(a1);
	free(a2);
	free(a3);
}
int main()
{
	//TestShellSort();
	TestOP();
	return 0;
}